//
//  DSZNavigationBarView.m
//  7.13苏宁框架
//
//  Created by app05 on 15/7/18.
//  Copyright (c) 2015年 lovena. All rights reserved.
//

#import "DSZNavigationBarView.h"

@implementation DSZNavigationBarView


- (instancetype)initWithFrame:(CGRect)frame
{
    if (self=[super initWithFrame:frame]) {
        
        UIView *navBarView=[[UIView alloc]initWithFrame:CGRectMake(0, 0, 320, 44)];
        navBarView.backgroundColor=[UIColor clearColor];
        [self addSubview:navBarView];
        
        UILabel *title=[[UILabel alloc]initWithFrame:CGRectMake(115, 7, 90, 30)];
        //title.text=_titleLabel;
        title.textAlignment=NSTextAlignmentCenter;
        title.textColor=[UIColor blackColor];
        title.font=[UIFont systemFontOfSize:17];
        _title=title;
        [navBarView addSubview:title];
        
        UIButton *button=[UIButton buttonWithType:UIButtonTypeRoundedRect];
        [button setBackgroundImage:[UIImage imageNamed:@"back_black_icon"] forState:UIControlStateNormal];
        button.frame=CGRectMake(13, 9.5, 30, 25);
        [button addTarget:self action:@selector(btnClick) forControlEvents:UIControlEventTouchUpInside];
        [navBarView addSubview:button];
        
        UIButton *moreBtn=[UIButton buttonWithType:UIButtonTypeRoundedRect];
        moreBtn.frame=CGRectMake(273, 7, 30, 30);
        [moreBtn setBackgroundImage:[UIImage imageNamed:@"more_big_icon"] forState:UIControlStateNormal];
        [moreBtn addTarget:self action:@selector(moreBtnClick) forControlEvents:UIControlEventTouchUpInside];
        [navBarView addSubview:moreBtn];

    }
    return self;
}
-(void)setTitleLabel:(NSString *)titleLabel
{
    _titleLabel=titleLabel;
    _title.text=_titleLabel;
}
-(void)btnClick
{
    if ([self.delegate respondsToSelector:@selector(btnClick)]) {
        [self.delegate btnClick];
    }
}

-(void)moreBtnClick
{
    if ([self.delegate respondsToSelector:@selector(moreBtnClick)]) {
        [self.delegate moreBtnClick];
    }
}

@end
